package com.java.springboot.service;

import com.java.springboot.mapper.Usermapper;
import com.java.springboot.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
public class UserserviceImpl implements Userservice {

    @Autowired
    private Usermapper usermapper;

    @Override
    public User getone(String username, String password) {
        return usermapper.getone(username,password);
    }

    @Override
    public User selectrolename(int id) {
        return usermapper.selectrolename(id);
    }

    @Override
    @Cacheable(value = {"User"},key = "#username")
    public User UserByUserName(String username) {
        User user = usermapper.UserByUserName(username);
        return user;
    }

}
